package com.treasure.common.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * @author sunhongmin
 * @date 2023/10/13 17:33
 * @description 短信用途
 */
@Getter
public enum SmsUsageEnum {
    LOGIN("login"),
    REGISTER("register"),
    OTHER("other");

    private final String code;

    SmsUsageEnum(String code) {
        this.code = code;
    }

    public static SmsUsageEnum getByCode(String code){
        for (SmsUsageEnum instance : SmsUsageEnum.values()) {
            if(Objects.equals(instance.getCode(),code)) return instance;
        }

        return SmsUsageEnum.OTHER;
    }
}
